home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15399 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  36 lines

  1. Path: newsource.ihug.co.nz!usenet
  2. From: hoggy@ihug.co.nz (John Hogg)
  3. Newsgroups: comp.lang.c++
  4. Subject: I need help with a data structure
  5. Date: 5 Apr 1996 06:43:20 GMT
  6. Organization: The Internet Group
  7. Message-ID: <4k2fe8$cb9@newsource.ihug.co.nz>
  8. NNTP-Posting-Host: hoggy.ihug.co.nz
  9. X-Newsreader: WinVN 0.92.1
  10.  
  11. Hi, I'm quite new to programming so I would like some advice on a program
  12. I'm going to write in C++.
  13.  
  14. I have a number of chapters for a book, stored as text files (ie. all
  15. ASCII characters). I need to 'read' through these chapters, then store
  16. and display the new words that occur in each chapter so that a glossary
  17. can be made for the key words. I also have a text file that contains 
  18. common words that should be omitted (ie. "a", "the" etc). There are no
  19. more than 1,000,000 words in each chapter and I estimate there will be 
  20. no more than 30,000 different words.
  21.  
  22. I have decided I should hash the words from the common word file into an
  23. array.  Then, each word I read in from the chapters could be checked 
  24. against this array and if it is not there I would hash it into another 
  25. array of 30,000 items, discarding it if it is already there. Then this 
  26. new word could be added to a binary tree to sort the words into 
  27. alphabetical order for storage and display purposes.
  28.  
  29. There is the added problem of words such as 'sweating' and æsweatÆ where
  30. the word æsweatÆ would only be required.  I could simply check if a word 
  31. has 'ing' on the end and remove it but then 'dancing' would become 'danc'.
  32. Maybe it would be quicker to display all the words and get the user to 
  33. delete the words not required.
  34.  
  35. I would appreciate any help you can give me.
  36.